<?php
declare (strict_types = 1);

namespace app\api\controller\wechat;

use app\admin\model\bargain\Bargain;
use app\admin\model\bargain\BargainUserHelp;
use app\admin\model\store\GoodsSku;
use app\admin\model\user\User;
use app\admin\model\wx\WxFans;
use app\BaseController;
use app\common\service\wechat\WechatService;
use EasyWeChat\Factory;
use think\facade\Log;
use think\Request;

class Course extends BaseController
{
    /**
     * Author:YangXinPeng
     * 公众号服务端入口
     * @throws \EasyWeChat\Kernel\Exceptions\BadRequestException
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \ReflectionException
     */
    public function server()
    {
        WechatService::toConfig();
    }



    /**
     * Author:YangXinPeng
     * 拼团模版通知
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function pinkNotice($params)
    {
        $config = config("setting.wechat");
        $app = Factory::officialAccount($config);
        $app->template_message->send([
            'touser' => 'okpwv5zBmkh75yUGMiqIapt08yCY',
            'template_id' => 'vnrZyEZpHunFu1ShGD4lejSjV4pzipophouEesojURM',
            'url' => 'https://easywechat.org',
            'data' => [
                //拼团状态
                'phrase2' => 'IPohe13',
                //参团人数
                'number9' => '3/5',
                //拼团商品
                'thing10'=>'杨新鹏',
                //订单编号
                'character_string13'=>'八位毕业季',
                //拼团时间
                'date8'=>date('Y-m-d H:i:s',time())
            ],
        ]);
    }






    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {



    }

    /**
     * 显示创建资源表单页.
     *
     * @return \think\Response
     */
    public function create()
    {
        //
    }

    /**
     * 保存新建的资源
     *
     * @param  \think\Request  $request
     * @return \think\Response
     */
    public function save(Request $request)
    {
        //
    }

    /**
     * 显示指定的资源
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function read($id)
    {
        //
    }

    /**
     * 显示编辑资源表单页.
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * 保存更新的资源
     *
     * @param  \think\Request  $request
     * @param  int  $id
     * @return \think\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * 删除指定资源
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function delete($id)
    {
        //
    }
}
